﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ServoDrivesLibAbstract
{
    public interface IServoControl
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="axis"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        int GetAxisError(int axis,ref int error);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="axis"></param>
        /// <returns></returns>
        int ClearAxisError(int axis);
        /// <summary>
        /// 设置轴使能
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <returns>错误码</returns>
        int SetAxisEnable(int axis);
        /// <summary>
        /// 设置轴失能
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <returns>错误码</returns>
        int SetAxisDisable(int axis);
        /// <summary>
        /// 轴绝度位置移动
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="position">目标位置</param>
        /// <returns>错误码</returns>
        int MoveAxisAbs(int axis, double position);
        /// <summary>
        /// 轴相对位置移动
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="position">目标位置</param>
        /// <returns>错误码</returns>
        int MoveAxis(int axis, double position);
        /// <summary>
        /// 清除轴当前位置
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <returns>错误码</returns>
        int ClearPosition(int axis);
        /// <summary>
        /// 获取轴当前编码器值
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="encoder">当前编码器值</param>
        /// <returns>错误码</returns>
        int GetEncoderUnit(int axis, ref double encoder);
        /// <summary>
        /// 回零运动
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <returns>错误码</returns>
        int SetHomeMove(int axis);
        /// <summary>
        /// 获取回零状态
        /// </summary>
        /// <param name="axis"></param>
        /// <param name="status"></param>
        /// <returns>错误码</returns>
        int GetHomeMove(int axis, ref int status);
       
        /// <summary>
        /// 获取轴状态
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="status">返回状态</param>
        /// <returns></returns>
        int GetAxisStatus(int axis,ref int status);

        /// <summary>
        /// 获取轴运动状态
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <returns></returns>
        int GetAxisMoveStatus(int axis);

        /// <summary>
        /// 获取当前速度
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="speed">返回速度</param>
        /// <returns></returns>
        int GetAxisSpeed(int axis,ref double speed);
        /// <summary>
        /// 设置脉冲值
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="equip">脉冲值</param>
        /// <returns>错误码</returns>
        int SetEquiv(int axis, double equip);
      
        /// <summary>
        /// 获取脉冲值
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="equip">脉冲值</param>
        /// <returns>错误码</returns>
        int GetEquiv(int axis, ref double equip);
        
        /// <summary>
        /// 设置运动参数
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="minSpeed">起始速度</param>
        /// <param name="maxSpeed">最大速度</param>
        /// <param name="tAcc">加速度</param>
        /// <param name="tDec">减速度</param>
        /// <param name="stopSpeed">停止速度</param>
        /// <param name="sramp">s曲线</param>
        /// <returns>错误码</returns>
        int SetProFile(int axis, double minSpeed, double maxSpeed, double tAcc, double tDec, double stopSpeed, double sramp);
       
        /// <summary>
        /// 获取运动参数
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <param name="minSpeed">起始速度</param>
        /// <param name="maxSpeed">最大速度</param>
        /// <param name="tAcc">加速度</param>
        /// <param name="tDec">减速度</param>
        /// <param name="stopSpeed">停止速度</param>
        /// <param name="sramp">s曲线</param>
        /// <returns>错误码</returns>
        int GetProFile(int axis, ref double minSpeed, ref double maxSpeed, ref double tAcc, ref double tDec, ref double stopSpeed, ref double sramp);
        
        /// <summary>
        /// 运动停止
        /// </summary>
        /// <param name="axis">轴号</param>
        /// <returns>错误码</returns>
        int MoveStop(int axis);
        /// <summary>
        /// 获取轴数量
        /// </summary>
        /// <param name="axisNums">返回轴数</param>
        /// <returns>错误码</returns>
        int GetAxisNums(ref int axisNums);
        
        int GetAxisType(int axis, ref int type);
    }
}
